#include <iostream>
#include <algorithm>
using namespace std;

int N;
int M;
int a[105];

signed main()
{
	cin>>N>>M;
	M = M%N;
	int cnt = M;
	for(int i=0;i<N;i++){
		cin>>a[cnt];
		cnt = (cnt+1)%N;
	}
	for(int i=0;i<N-1;i++){
		cout<<a[i]<<" ";
	}
	cout<<a[N-1];
	return 0;
 } 
